import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:lcapp/basic/local_info.dart';
import 'package:lcapp/model/event/event_bus.dart';
import 'package:lcapp/model/login/login_util.dart';

Widget lcGestureDetector({Function? onTap,Widget? child,bool isLogin = false,Function? loginFun}){
  return GestureDetector(
    onTap: (){
      if(isLogin && AsrLocalInfo.token==null){
        SmartDialog.dismiss();
        eventBus.fire(HomeChangeIndex(canPlay:false));
        LoginUtil.login();
        return;
      }
      if(onTap!=null){
        onTap();
      }
    },
    child: child,
  );
}